<?php

namespace Xcloze\Jobs\Api\Controller;

use Xcloze\Jobs\Api\Services\PushJobs;

class Index
{
    public function push()
    {
        $data=$_GET['jobData'] ?? $_POST['jobData'] ?? '';
        $pushJobs=new PushJobs();
        echo $pushJobs->pushSimple($data);
    }

    public function demo()
    {
        //demo
        $data['topic'] = 'MyJob';
        $data['jobClass']  = '\app\index\Controller\JobAction';
        $data['jobMethod']= 'test1';
        $data['jobParams']=['xieyuhua', date('Y-m-d:h:i:s',time())];
        $data['jobExtras']=[];
        $data['serializeFunc']='php';

        $dataJob  = json_encode($data);
        $pushJobs = new PushJobs();
        
        
        for($i=0; $i<1000000; $i++){
            echo $pushJobs->pushSimple($dataJob);
        }
        
        
    }
}
